﻿@{
    ViewBag.Title = ViewData["SiteName"] + " - " + ViewData["PageTitle"];
    Layout = "~/RazorThemes/Default/Views/Shared/_Layout.cshtml";
}
@section HtmlHead{
    <link href="/Content/jquery-ui-1.7.2.custom.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        label.error
        {
            float: none;
            color: red;
            padding-left: .5em;
            vertical-align: top;
        }
    </style>    
}


<div class="contentpage-outerdiv">
    <h2>Manage Profile for @Context.User.Identity.Name </h2>
    @Html.ValidationSummary() 
    @if (ViewData["previouspage"].ToString()!=""){
        <a href="@ViewData["returnUrl"].ToString()">@ViewData["previouspage"].ToString()</a>
    }
    <div class="resource-body">@ViewData["resourcebody"]</div>
    @using (Html.BeginForm("UserProfile", "Account", FormMethod.Post, new { id = "form1" }))
    { 
    <div>
        <fieldset>
            <legend>Site Preferences</legend>
            <table>      
                <tr>
                    <td colspan="2">
                            <label for="email">
                                Email Address</label>
                            @Html.TextBox("Email", ViewData["Email"], new  { @class= "required email" })
                            @Html.ValidationMessage("Email")                    
                    </td>
                </tr>     
                <tr>
                    <td>
                        <p>
                            <label for="subscriptionType">
                                Subscription Type</label>
                            @Html.DropDownList("subscriptionType")
                            @Html.ValidationMessage("subscriptionType")
                        </p>
                    </td>
                    <td>
                        <p>
                            <label for="language">
                                Language</label>
                            @Html.DropDownList("languageid")
                            @Html.ValidationMessage("languageid")
                        </p>
                    </td>
                </tr>
            </table>
            <legend>Personal Details</legend>
            <table>
                <tr>
                    <td valign="top">
                         <p>
                            <label for="firstName">
                                First Name</label>
                            @Html.TextBox("firstName")
                            @Html.ValidationMessage("firstName")
                        </p>
                    </td>
                    <td>
                        <p>
                            <label for="lastName">
                                Last Name</label>
                            @Html.TextBox("lastName")
                            @Html.ValidationMessage("lastName")
                        </p>
                        <p>
                            <label for="genderType">
                                Gender</label>
                            @Html.DropDownList("genderType")
                            @Html.ValidationMessage("genderType")
                        </p>
                    </td>
                    <td>
                        <p>
                            <label for="birthDate">
                                Birth Date</label>
                            @Html.TextBox("birthDate")
                            @Html.ValidationMessage("birthDate")
                        </p>
                        <p>
                            <label for="website">
                                Website</label>
                            @Html.TextBox("website")
                            @Html.ValidationMessage("website")
                        </p>
                    </td>
                </tr>
            </table>
            <legend>Address Information</legend>
            <table>
                <tr>
                    <td>
                        <p>
                            <label for="city">
                                City</label>
                            @Html.TextBox("city")
                            @Html.ValidationMessage("city")
                        </p>
                        <p>
                            <label for="state">
                                State</label>
                            @Html.DropDownList("StateProvinceID")
                            @Html.ValidationMessage("StateProvinceID")
                        </p>
                    </td>
                    <td>
                        <p>
                            <label for="street">
                                Street</label>
                            @Html.TextBox("street")
                            @Html.ValidationMessage("street")
                        </p>                        
                        <p>
                            <label for="zipcode">
                                Zip / Postal Code</label>
                            @Html.TextBox("zipcode")
                            @Html.ValidationMessage("zipcode")
                        </p>
                    </td>
                    <td>
                        <p>
                            <label for="zipcode">
                                Phone/Cell</label>
                            @Html.TextBox("cell")
                            @Html.ValidationMessage("cell")
                        </p>
                    </td>
                    <td>
                    </td>
                </tr>
            </table>
            <input type="submit" value="Update Profile" />
        </fieldset>
    </div>
    @Html.Hidden("returnUrl", ViewData["returnUrl"].ToString()) 
    } 
</div>     

@section ScriptContent{
    <script src="/Scripts/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery-ui-datepicker.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.validate.min.js" type="text/javascript"></script>
    <script type="text/javascript" >
	$(function() {
	    $('#birthDate').datepicker({
	        changeMonth: true,
	        changeYear: true,
	        minDate: -32850,
	        yearRange: '-90:+0',
	        maxDate: '-1M +10D'	        
	    });
	});

	$("#form1").validate({
	    submitHandler: function(form) {
		    form.submit();
	    }
	});
	
</script>
}